//package com.x9space.framework.config;
//
//import com.x9space.framework.config.properties.ElasticsearchProperties;
//import org.apache.http.HttpHost;
//import org.elasticsearch.client.RestClient;
//import org.elasticsearch.client.RestClientBuilder;
//import org.elasticsearch.client.RestHighLevelClient;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//
//import javax.annotation.Resource;
//import java.util.concurrent.TimeUnit;
//
//@Configuration
//public class ElasticsearchConfig   {
//
//    @Resource
//    private ElasticsearchProperties elasticsearchProperties;
//
//    @Bean
//    public RestHighLevelClient elasticsearchClient() {
//        RestClientBuilder builder = RestClient.builder(new HttpHost(elasticsearchProperties.getHost(), elasticsearchProperties.getPort(), elasticsearchProperties.getScheme()));
//        return new RestHighLevelClient(builder.setHttpClientConfigCallback(requestConfig ->
//                requestConfig.setKeepAliveStrategy((response, context) -> TimeUnit.MINUTES.toMillis(3))));
//    }
//}
